package com.xohn.ffmpeg;

/**
 * Created by xohn on 2020/7/30.
 */

public class AVUtils {
    static {
        System.loadLibrary("xohn_avutils");
    }

    private static AVUtils instance;

    public static AVUtils getInstance(){
        if(instance == null) {
            synchronized (AVUtils.class){
                if(instance == null) {
                    instance = new AVUtils();
                }
            }
        }
        return instance;
    }

    public native String stringFromJNI();
    //yuv
    public native int yuv420Split(String path,int w,int h,int num);
    public native int yuv444Split(String path,int w,int h,int num);
    public native int yuv420Gray(String path,int w,int h,int num);
    public native int yuv420Halfy(String path,int w,int h,int num);
    public native int yuv420Border(String path,int w,int h,int border,int num);
    public native int yuv420GrayBar(String path,int w,int h,int ymin,int ymax,int barnum);
    public native int yuv420Psnr(String path1,String path2,int w,int h,int num);
    //rgb
    public native int rgb24Split(String path,int w,int h,int num);
    public native int rgb24ToBmp(String rgb24path,int w,int h,String bmppath);
    public native int rgb24ToYuv420(String rgb24path,int w,int h,int num,String yuv420path);
    public native int rgb24ColorBar(int w,int h,String path);
    //pcm
    public native int pcm16leSplit(String path);
    public native int pcm16leHalfVolLeft(String path);
    public native int pcm16leDoubleSpeed(String path);
    public native int pcm16leToPcm8(String path);
    public native int pcm16leCutSingleChannel(String path,int start_num,int dur_num);
    public native int pcm16leToWave(String pcmInPath,int channels,int sample_rate,String waveOutPath);
    //h264
    public native int h264Parser(String path);
    //aac
    public native int aacParser(String path);
    //flv
    public native int flvParser(String path);
    //udp-rtp
    public native int udpRtpParser(String path);
}
